#include <time.h>
#include <limits.h>

clock_t clock()
{
	struct timespec ts;
	if (__clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts))
		return -1;

	return (clock_t)((ts.tv_sec * 1000000000 + ts.tv_nsec) / (1000000000 / CLOCKS_PER_SEC));
}
